local CheckWidgetType = UI.CheckWidgetType
local CheckArgType = UI.CheckArgType
local CheckArgWidget = UI.CheckArgWidget
local MakeAccessor = UI.MakeAccessor
local MakeTypeSetter = UI.MakeTypeSetter

--[[ StatusBar @FIXME ]]--
local StatusBar = UI.NewWidgetType("StatusBar", "Frame")
StatusBar.parameters = {
	value = 0,
	minvalue = 0,
	maxvalue = 0,
	sbcolorred = 1,
	sbcolorgreen = 1,
	sbcolorblue = 1,
	sbcoloralpha = 1,
	orientation = "HORIZONTAL",
}

function StatusBar:Initialize(o)
	local t = UI.params[o]
	assert(t)
end

UI.MakeTextureFunctions(StatusBar, "StatusBar", "StatusBar", true)

MakeTypeSetter("StatusBar", "SetMinMaxValues", {"minvalue", "maxvalue"}, {"number", "number"})
MakeAccessor("StatusBar", "GetMinMaxValues", {"minvalue", "maxvalue"})

MakeTypeSetter("StatusBar", "SetValue", "value", "number")
MakeAccessor("StatusBar", "GetValue", "value")

MakeAccessor("StatusBar", "GetStatusBarColor", {"sbcolorred", "sbcolorgreen", "sbcolorblue", "sbcoloralpha"})
MakeTypeSetter("StatusBar", "SetStatusBarColor", {"sbcolorred", "sbcolorgreen", "sbcolorblue", "sbcoloralpha"}, {"number", "number", "number", {"number", "nil"}})

MakeAccessor("StatusBar", "GetOrientation", "orientation")

function StatusBar.prototype:SetOrientation(orientation)
	CheckWidgetType("StatusBar:SetOrientation", self, "StatusBar")
	assert(UI.ValidOrientationName[orientation], "Invalid orientation")
	UI.params[self].orientation = orientation
end

UI.RegisterScriptHandlers(StatusBar, "OnValueChanged", "OnMinMaxChanged")
